package com.homework.str;

public class test7 {
  public static void main(String[] args) {
    // 统计字符串“abcdefgabdcdefgabcddefg”里有多少个字符‘d’；
    String s = "abcdefgabdcdefgabcddefgddddddd";
    int count = 0;
    String[] sarr = s.split("");
    for (String a : sarr) {
      if (a.equals("d")) {
        count += 1;
      }
    }
    System.out.println(count);
  }
}
